#!/usr/bin/env node

const{ EventEmitter } = require('events');
const evt = new EventEmitter();

evt.on('hello',()=> console.log('hello world'));
evt.on('bye',() => {
    console.log('goodbye');
    process.exit();    
})

setInterval(() => {
    evt.emit('hello');
},1000);

setTimeout(()=>{
    evt.emit('bye')
},5000);